package cn.psvmc.cxzapi.util;

import cn.psvmc.cxzapi.model.common.CommPageResult;
import cn.psvmc.cxzapi.response.PageResult;
import cn.psvmc.cxzapi.response.PageResult2;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 * @author ywx
 * @classname PageUtil
 * @description
 * @date 2023/8/2 11:44
 **/
public class PageUtil {
    public static CommPageResult getPageResult(IPage<?> pageInfo) {
        CommPageResult pageResult = new CommPageResult();
        pageResult.setTotal(pageInfo.getTotal());
        pageResult.setData(pageInfo.getRecords());
        return pageResult;
    }

    public static PageResult2 getPageResult2(IPage<?> pageInfo) {
        PageResult2 pageResult = new PageResult2();
        pageResult.setTotal(pageInfo.getTotal());
        pageResult.setObj(pageInfo.getRecords());
        pageResult.setCode(0);
        pageResult.setMsg("查询成功！");
        return pageResult;
    }
}
